class Stack:
    internalList = []
	#Common methods
    def isEmpty(self):
        return self.size() == 0

    def size(self):
        return len(self.internalList)

    def checkNotEmpty(self):
        if self.isEmpty():
            raise Exception("Empty Stack!  There are no elements to work with.")

    def __iter__(self):
        return self.internalList.__iter__()

    def __repr__(self):
        return "a Stack with[" + ", ".join(map(str, self.internalList)) + "]"
    #End of Common methods
    

    def push(self, element):
        self.internalList.append(element)

    def peek(self):
        self.checkNotEmpty()
        return self.internalList[self.size() - 1]

    def pop(self):
        self.checkNotEmpty()
        return self.internalList.pop(self.size() - 1)

def createStack():
    return Stack()

def pushToStack(stack, element):
    stack.push(element)

def popFromStack(stack):
    return stack.pop()

def peekFromStack(stack):
    return stack.peek()

def isEmptyStack(stack):
    return stack.isEmpty()

def sizeOfStack(stack):
    return stack.size()
